﻿using Paging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Ordering.API.Application.Queries
{
    public class OrderSummaryModel
    {
        public int PageIndex { get;  set; }

        public int PageSize { get;  set; }

        public long Count { get; private set; }
        public IEnumerable<OrderStatusNum> OrderStatusNums { get; set; }
        public IEnumerable<OrderModel> Orders { get; set; }

        public OrderSummaryModel(int pageIndex,int pageSize,long count, 
            IEnumerable<OrderStatusNum> orderStatusNums, IEnumerable<OrderModel> orders)
        {
            this.PageIndex = pageIndex;
            this.PageSize = pageSize;
            this.Count = count;
            this.OrderStatusNums = orderStatusNums;
            this.Orders = orders;
        }
    }
    /// <summary>
    /// 订单
    /// </summary>
    public class OrderModel
    {
        public int Id { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        public string OrderNO { get; set; }
        /// <summary>
        /// 订单类别(0:扔垃圾 1：取快递)
        /// </summary>
        public int OrderType { get;  set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 订单创建时间
        /// </summary>
        public DateTime CreateTime { get;  set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateTime { get;  set; }
        /// <summary>
        /// 预约时间
        /// </summary>
        public DateTime AppointmentTime { get;  set; }
        /// <summary>
        /// 客户编码
        /// </summary>
        public string CustomerCode { get;  set; }
        /// <summary>
        /// 订单状态
        /// </summary>
        public int OrderStatusId { get;  set; }
        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get;  set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 订单明细
        /// </summary>
        public IEnumerable<OrderItemModel> OrderItems { get; set; }
    }
    /// <summary>
    /// 订单状态数量
    /// </summary>
    public class OrderStatusNum
    {
        public int OrderStatusId { get; set; }

        public int OrderNum { get; set; }
    }
    /// <summary>
    /// 订单明细
    /// </summary>
    public class OrderItemModel
    {
        public int OrderId { get; set; }

        public decimal ProductCode { get; set; }

        public string ProductName { get; set; }

        public string ExtendField { get; set; }

        public int Num { get; set; }

        public string Remark { get; set; }

        public string PictureId { get; set; }
    }

    /// <summary>
    /// 订单过滤
    /// </summary>
    [Serializable]
    public class OrderFilter : SqlFilter<OrderModel>
    {
        /// <summary>
        /// 订单编码
        /// </summary>
        public string OrderNO { get; set; }
        /// <summary>
        /// 订单类型
        /// </summary>
        public int? OrderType { get; set; }

        public DateTime? Start_CreateTime { get; set; }

        public DateTime? End_CreateTime { get; set; }

        /// <summary>
        /// 客户编码
        /// </summary>
        public string CustomerCode { get;  set; }
        /// <summary>
        /// 订单状态
        /// </summary>
        public int? OrderStatusId { get;  set; }
    }

    public enum OrderStatusEnum
    {
        /// <summary>
        /// 下单
        /// </summary>
        Submitted = 1,
        /// <summary>
        /// 支付
        /// </summary>
        Paid = 2,
        /// <summary>
        /// 支付
        /// </summary>
        ReceiveConfirmed = 3,
        /// <summary>
        /// 配送
        /// </summary>
        Delivery = 4,
        /// <summary>
        /// 完成
        /// </summary>
        Completed = 5,
        /// <summary>
        /// 取消
        /// </summary>
        Cancelled = 6
    }
}
